const path = require('path')

const CssLoader = (importLoaders) => {
  return {
    loader: 'css-loader',
    options: {
      importLoaders: importLoaders
    }
  }
}

module.exports = {
  entry: './src/index.js',
  output: {
    filename: 'bundle.js',
    path: path.resolve(__dirname, 'dist')
  },
  module: {
    rules: [{
      test: /\.css$/,
      use: [
        'style-loader', 
        CssLoader(1), 
        'postcss-loader'
      ]
    }, {
      test: /\.less$/,
      use: [
        'style-loader', 
        CssLoader(1),
        'postcss-loader', 
        'less-loader'
      ]
    }]
  }
}